<?php
// +----------------------------------------------------------------------
// | [RhaPHP System] Copyright (c) 2017 http://www.rhaphp.com/
// +----------------------------------------------------------------------
// | [RhaPHP] 并不是自由软件,你可免费使用,未经许可不能去掉RhaPHP相关版权
// +----------------------------------------------------------------------
// | Author: Geeson <qimengkeji@vip.qq.com>
// +----------------------------------------------------------------------

namespace addons\weiweb\controller;


use app\common\controller\Addon;

class Preview extends Addon
{


    public function show()
    {

        $url = getHostDomain() . addonUrl('index/article', ['id' => input('id')]);
        $getQrUrl = getHostDomain() . addonUrl('preview/qrcode').'?url='.urlencode($url);
        $this->assign('url', $url);
        $this->assign('getQrUrl',$getQrUrl);
        $this->fetch();
    }

    public function qrcode()
    {
        $url = input('url');
        header("Content-type: image/png");
        $url = urldecode($url);
        include_once EXTEND_PATH.'phpqrcode/phpqrcode.php';
        \Qrcode::png($url, $file = false, $level = 'L', $size = 4);
        exit();

    }







}